package com.cjm.struts2.helloworld;

import com.opensymphony.xwork2.ActionContext;

import java.util.Map;

/**
 * Created by tony on 2015/6/22.
 */
public class TestActionContextAction  {
    public String execute(){

        ActionContext actionContext = ActionContext.getContext();

        Map<String, Object> actionMap = actionContext.getApplication();

        actionMap.put("actionMapKey", "actionMapValue");

        Map<String, Object> session = actionContext.getSession();
        session.put("sessionmap", "seesion");

//        获取request
        Map<String, Object> requestMap = (Map<String, Object>) actionContext.get("request");
        requestMap.put("requestMap","niubi");

//        获取parameters
        Map<String, Object> parameters = actionContext.getParameters();
        System.out.println(parameters.get("name"));
        parameters.put("age", 100);
        return "success";
    }
}

